package com.wywah.yunduo.security.core;

import com.wywah.yunduo.orm.bean.UserInfo;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

public class LoginUserInfo implements UserDetails {
    private UserInfo user;


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return List.of();
    }

    @Override
    public String getPassword() {
        return String.format("{%s}%s", user.getEncrpty(), user.getPassword());
    }

    @Override
    public String getUsername() {
        return user.getNickname();
    }

    public UserInfo getUser() {
        return user;
    }

    public void setUser(UserInfo user) {
        this.user = user;
    }
}
